import typing
from pydantic import root_validator, BaseModel, Field
from autotest.schemas.base import BaseSchema


class ApiQuery(BaseSchema):
    """查询参数序列化"""

    id: int = Field(None, description="id")
    sence_name: str = Field(None, description="sence_name")


class DfApiListQuery(BaseSchema):
    """查询参数序列化"""
    api_org_id: int = Field(None, description="域名")
    sort_type: str = Field(None, description="排序类型")

class DfApiQuery(BaseSchema):
    """查询参数序列化"""

    id: int = Field(None, description="id")
    sence_name: str = Field(None, description="接口名")
    api_org_id: int = Field(None, description="域名")
    api_org_module_id: int = Field(None, description="子域名")
    req_url: str = Field(None, description="接口名")
    created_by: str = Field(None, description="创建人")
    # created_by_name: str = Field(None, description="创建人")
    sort_type: str = Field(None, description="排序类型")
    order_field: str = Field(None, description="排序字段")



class DfApiIn(BaseModel):
    id: int = Field(None, description="")
    sence_name: str = Field('', description="场景名")
    api_org_id: int = Field(1, description="域名")
    api_org_module_id: int = Field(1, description="子域名")
    api_type: int = Field(1, description="接口请求类型")
    api_status: int = Field(1, description="场景状态")
    req_url: str = Field('', description="接口名")
    req_method: str = Field('', description="接口请求类型")
    req_headers: typing.List[typing.Dict] = Field([], description="请求头")
    req_data_moudle: typing.List[typing.Dict] = Field([], description="请求参数")
    remarks: str = Field('', description="描述")


class DfApiId(BaseModel):
    id: int = Field(None, description="id")